#include<Mesh/Mesh_Operator.h>


#define quote lib_cell_quote
Mesh operator*(Mesh& m,double v)
{
    for(auto iter=m.v_begin(&m);iter!=m.v_end(&m);iter++)
    {
        for(int i=0;i<quote(iter)->point_size;i++)
        {
            quote(iter)->point[i]*=v;
        }
    }
    return m; 
}
Mesh operator+(Mesh&m,double* p)
{
    for(auto iter=m.v_begin(&m);iter!=m.v_end(&m);iter++)
    {
        for(int i=0;i<quote(iter)->point_size;i++)
        {
            quote(iter)->point[i]+=p[i];
        }
    }
    return m;
}

Mesh operator-(Mesh&m,double *p)
{
    for(auto iter=m.v_begin(&m);iter!=m.v_end(&m);iter++)
    {
        for(int i=0;i<quote(iter)->point_size;i++)
        {
            quote(iter)->point[i]-=p[i];
        }
    }
    return m;
}
Mesh* operator+=(Mesh&m1,Mesh&m2)
{
    Int_RB_Tree* tree_v=(Int_RB_Tree*)malloc(sizeof(Int_RB_Tree));
    int_rb_tree_init(tree_v);

    Int_RB_Tree* tree_hf=(Int_RB_Tree*)malloc(sizeof(Int_RB_Tree));
    int_rb_tree_init(tree_hf);
    
    Int_RB_Tree* tree_c=(Int_RB_Tree*)malloc(sizeof(Int_RB_Tree));
    int_rb_tree_init(tree_c);
    for(auto vit=m2.v_begin(&m2);vit!=m2.v_end(&m2);vit++)
    {
        

    }

    for(auto cit=m2.c_begin(&m2);cit!=m2.c_end(&m2);cit++)
    {

        // for()
        // {

        // }
    }

    int_rb_tree_free(tree_c);
    int_rb_tree_free(tree_hf);
    int_rb_tree_free(tree_v);
    return &m1;
}